package com.modificial.springboot;

import com.modificial.springboot.dao.UserDao;
import com.modificial.springboot.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author modificial
 */
@SpringBootApplication
@RestController
@RequestMapping("/user")
public class SpringbootJdbcApplication {

    @Autowired
    private UserDao userDao;

    public static void main(String[] args) {
        SpringApplication.run(SpringbootJdbcApplication.class, args);
    }

    /**
     * 查询所有用户信息
     *
     * @return
     */
    @GetMapping("/listUsers")
    public List<User> listUsers() {

        return userDao.listUsers();
    }
}
